﻿using System;
using System.IO;
using Spring.Context;
using Spring.Context.Support;
using Spring.Core.IO;

namespace SpringSeries.Core.Resource
{
    class Program
    {
        static void Main(string[] args)
        {
            IApplicationContext _ctx = ContextRegistry.GetContext();

            IResource _resource1 = _ctx.GetResource("file:///C:/WINDOWS/ODBC.INI");
            IResource _resource2 = _ctx.GetResource("http://blogs.ugidotnet.org/bmatte/Default.aspx");
            IResource _resource3 = _ctx.GetResource("assembly://14.Resource/SpringSeries.Core.Resource/TextFile.txt");

            StreamReader _reader1 = new StreamReader(_resource1.InputStream);
            Console.WriteLine(_reader1.ReadToEnd());

            StreamReader _reader2 = new StreamReader(_resource2.InputStream);
            Console.WriteLine(_reader2.ReadToEnd());

            StreamReader _reader3 = new StreamReader(_resource3.InputStream);
            Console.WriteLine(_reader3.ReadToEnd());

            Console.Read();

//#if DEBUG
//            IApplicationContext _ctx = new XmlApplicationContext("file://objects.xml");
//#else
//            IApplicationContext _ctx = ContextRegistry.GetContext();
//#endif
        }
    }
}

